home *** CD-ROM | disk | FTP | other *** search
/ Amiga Games 1996 July / Amiga Games 1996 #7.iso / archive / userbox / publicdomain / muispell.lha / MUISpell / Source / Main.c < prev   
C/C++ Source or Header  |  1996-03-28  |  4KB  |  133 lines

  1. /***************************************************************************
  2. *                                                                                                    *
  3. *    MUISpell                                                                                    *
  4. *    Spellchecking without texteditor, requires AlphaSpell and MUI            *
  5. *    Copyright (C) 1996  Dirk Holtwick                                                    *
  6. *                                                                                                    *
  7. *    This program is free software; you can redistribute it and/or modify    *
  8. *    it under the terms of the GNU General Public License as published by    *
  9. *    the Free Software Foundation; either version 2 of the License, or        *
  10. *    (at your option) any later version.                                                *
  11. *                                                                                                    *
  12. *    This program is distributed in the hope that it will be useful,            *
  13. *    but WITHOUT ANY WARRANTY; without even the implied warranty of            *
  14. *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
  15. *    GNU General Public License for more details.                                    *
  16. *                                                                                                    *
  17. *    You should have received a copy of the GNU General Public License        *
  18. *    along with this program; if not, write to the Free Software                *
  19. *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                    *
  20. *                                                                                                    *
  21. *      Author:   Dirk Holtwick                                                                *
  22. *                    Karlstr. 59                                                                    *
  23. *                    47119 Duisburg                                                                *
  24. *                    GERMANY                                                                        *
  25. *                    dirco@uni-duisburg.de                                                    *
  26. *                                                                                                    *
  27. ****************************************************************************/
  28.  
  29. // This sourcecode has been translated by the MaxonC++ Compiler
  30.  
  31. // The program has been written for MUI2.3 and I didn't change
  32. // it until now, but be aware that the var MUIMASTER_VMIN is
  33. // used in this source, so it depends on the includes that you
  34. // use, with wich MUI version your program may be used.
  35.  
  36. #define WBWINNAME "con:20/20/300/100/ERRORS/close/auto/wait"
  37.  
  38. #include <wbstartup.h> 
  39. #include <workbench/workbench.h>
  40. #include <pragma/muimaster_lib.h>
  41. #include <pragma/exec_lib.h>
  42. #include <pragma/asl_lib.h>
  43. #include <pragma/dos_lib.h>
  44. #include <pragma/icon_lib.h>
  45. #include <clib/alib_protos.h>
  46. #include <libraries/mui.h>
  47. #include <exec/memory.h>
  48. #include <stdlib.h>
  49. #include <stdio.h>
  50. #include <string.h>
  51. #include <time.h>
  52. #include <ctype.h>
  53.  
  54. struct Library * LocaleBase=0;
  55. struct Library * MUIMasterBase;
  56. struct ObjApp * App = NULL;
  57. struct FileRequester *fr;
  58.  
  59. // KATALOGFUNKTIONEN BEKANNT MACHEN
  60. extern void OpenMUISpellCatalog(struct Locale *, STRPTR);
  61. extern void CloseMUISpellCatalog(void);
  62. extern STRPTR GetMUISpellString(LONG);
  63.  
  64. // DIE EIGENEN INCLUDES
  65. #include "gui.h"
  66. #include "cat.h"
  67. #include "hooks.c"
  68.  
  69. // UEBERNOMMEN VON MUI
  70. static void init( void ){
  71.     if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN))){
  72.         printf("Can't Open MUIMaster Library");
  73.         exit(20);
  74.     }
  75. }
  76.  
  77. // HAUPTPROGRAMM
  78. void main(){
  79.     BOOL    running = TRUE;
  80.     ULONG    signal,*d,*b;
  81.  
  82.     init();
  83.  
  84.    LocaleBase = OpenLibrary("locale.library", 38);
  85.    OpenMUISpellCatalog(NULL, NULL);
  86.  
  87.     if(fr=MUI_AllocAslRequestTags (
  88.         ASL_FileRequest, 
  89.         TAG_DONE
  90.     )){
  91.         App = CreateApp();
  92.  
  93.         DoMethod(App->App,MUIM_Application_Load,MUIV_Application_Load_ENV);
  94.         do_editdist();
  95.  
  96.         while (running){
  97.             switch(DoMethod(App->App,MUIM_Application_Input,&signal)){
  98.                 case MUIV_Application_ReturnID_Quit:
  99.                     if(!chok()) break;
  100.                     if(learned && ramdict){
  101.                         if(MUI_RequestA (
  102.                             App->App,App->win_view,0,NULL,
  103.                             GetMUISpellString(m_reqbt_learned),GetMUISpellString(m_req_learned),0
  104.                         )){
  105.                             get(App->str_drawer, MUIA_String_Contents, &d);
  106.                             get(App->str_user, MUIA_String_Contents, &b);
  107.                             sprintf(command,"c:copy \"ram:%s.mix\" \"ram:%s.low\" \"ram:%s.ldx\" \"ram:%s.mdx\" to \"%s\"",b,b,b,b,d);
  108.                             Ex(command);
  109.                         }
  110.                     }
  111.                     running=FALSE;
  112.                     break;
  113.             }
  114.             if (running && signal) Wait(signal);
  115.         };
  116.  
  117.         MUI_FreeAslRequest(fr);
  118.         DisposeApp(App);
  119.     }else puts("Konnte ASL-Requester nicht öffnen");
  120.  
  121.    CloseMUISpellCatalog();
  122.    if (LocaleBase != NULL) CloseLibrary(LocaleBase);
  123.  
  124.     CloseLibrary(MUIMasterBase);
  125.  
  126.     DeleteFile ("t:text.cor");
  127.     DeleteFile ("t:text.sug");
  128.  
  129.     freeall();
  130.     exit(0);
  131. }
  132.  
  133.